<?php

$db = new Database();

if(isset($_POST['action'])){
    
    /*  ================================================
        =====  Generate List of table depend
        on the selected table (Create dump files) ======
        ================================================ */
    
    if($_POST['action'] == "get_table"){
        $db_name = $_POST['db_name'];
        
        $table_name = $db->query("SHOW TABLES FROM $db_name","array");
        
        echo json_encode($table_name);
    }
    
    /*  ================================================
        =====  Generate Exporting (Create dump files) =====
        ================================================ */
    
    elseif($_POST['action'] == "generate_exporting"){
        $database_name = $_POST['database_name'];
        $tables = $_POST['tables'];
        $strip_tables = array();
        $strip_tables = explode("," , $tables);
        //echo json_encode($strip_tables);
        $ed = new Exporting_Database();
        $ret = $ed->export_download_selected_table($database_name,$strip_tables,'');
        
        echo $ret;
    }
    
}


?>